/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.SwingWorker;
import javax.swing.border.TitledBorder;


/**
 *
 * @author bob
 */
public class General extends javax.swing.JFrame {

    /**
     * Creates new form General
     */
    public General() throws SQLException, ClassNotFoundException {
        initComponents();  
        informationPane.moveToFront(tenantPanel);         
        table.setAutoCreateRowSorter(true);          
        showAllFromDropBox();
        
        DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
        leaseStartDateBox.setDateFormat(df);
 
        //endDate.setDateFormat(df);

    }
    boolean editing = true;
    private String[] stringFromRow()
    {  
        String[] strArray = {""};
        System.out.println("CALLING STRING FROM ROW");
        String str = "";
       // String[] strArray;
        int row = table.getSelectedRow();
       if(row != -1)
       {
            for(int i = 0; i < table.getColumnCount(); i++)
            {
                System.out.println(i);
                if(table.getValueAt(row, i) != null)
                {
                    str += table.getValueAt(row, i).toString() + "#";
                }
                else
                {
                    str+= null+"#";
                }
            }
            str.trim();
            System.out.println(str);
            strArray = str.split("#");        
       }
        return strArray;
    }
    
    private ListTableModel getTableFromQuery(String str) throws SQLException
    {
        DBconnection db = new DBconnection();
        Connection conn = db.getConnection();      
        Statement stmt = conn.createStatement();
        ResultSet rset = null;
        if(str.startsWith("SELECT"))
        {
            rset = stmt.executeQuery(str);      
        }
        else if(str.startsWith("UPDATE") || str.startsWith("INSERT"))
        {
            stmt.executeUpdate(str);
            //get the record that was just inserted/updated
            
            rset = stmt.executeQuery("SELECT ");
        }
        else if(str.startsWith("DELETE"))
        {
            stmt.executeUpdate(str);
            //get table name
            
            rset = stmt.executeQuery("SELECT * FROM ");
        }       

        ListTableModel model = ListTableModel.createModelFromResultSet( rset );
        
        stmt.close();       
        return model;
    }
    
     public static String getCurrentTimeStamp() 
     {
        SimpleDateFormat sdfDate = new SimpleDateFormat("MM-dd-yyyy HH:mm");
        Date now = new Date();
        String strDate = sdfDate.format(now);
        return strDate;
     }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jPanel2 = new javax.swing.JPanel();
        selectionBox = new javax.swing.JComboBox();
        showAllButton = new javax.swing.JButton();
        backButton = new javax.swing.JButton();
        informationPane = new javax.swing.JLayeredPane();
        leasePanel = new javax.swing.JPanel();
        jLabel74 = new javax.swing.JLabel();
        leaseSearchButton = new javax.swing.JButton();
        jLabel75 = new javax.swing.JLabel();
        leaseTypeDropBox = new javax.swing.JComboBox();
        jLabel77 = new javax.swing.JLabel();
        leaseSSNSearchBox = new javax.swing.JTextField();
        leaseSSNBox = new javax.swing.JTextField();
        leaseAddButton = new javax.swing.JButton();
        leaseUpdateButton = new javax.swing.JButton();
        leaseDeleteButton = new javax.swing.JButton();
        jLabel81 = new javax.swing.JLabel();
        jLabel83 = new javax.swing.JLabel();
        jLabel111 = new javax.swing.JLabel();
        leaseStartDateBox = new datechooser.beans.DateChooserCombo();
        tenantPanel = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        tenantSearchButton = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        tenantSearchDropBox = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        tenantSearchBox = new javax.swing.JTextField();
        tenantSSNBox = new javax.swing.JTextField();
        tenantFirstNameBox = new javax.swing.JTextField();
        tenantLastNameBox = new javax.swing.JTextField();
        tenantPhoneNumberBox = new javax.swing.JTextField();
        tenantEmailBox = new javax.swing.JTextField();
        tenantAptNumberBox = new javax.swing.JTextField();
        tenantAddButton = new javax.swing.JButton();
        tenantUpdateButton = new javax.swing.JButton();
        tenantDeleteButton = new javax.swing.JButton();
        jLabel42 = new javax.swing.JLabel();
        jLabel43 = new javax.swing.JLabel();
        jLabel49 = new javax.swing.JLabel();
        jLabel50 = new javax.swing.JLabel();
        utilitiesPanel = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        utilitiesProviderBox = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        utilitiesCostBox = new javax.swing.JTextField();
        utilitiesTypeBox = new javax.swing.JComboBox();
        utilitiesAdd = new javax.swing.JButton();
        utilitiesUpdate = new javax.swing.JButton();
        utilitiesDelete = new javax.swing.JButton();
        jLabel51 = new javax.swing.JLabel();
        jLabel52 = new javax.swing.JLabel();
        jLabel53 = new javax.swing.JLabel();
        vehiclePanel = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        vehicleSearchButton = new javax.swing.JButton();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        vehicleSearchStateBox = new javax.swing.JTextField();
        vehicleStateBox = new javax.swing.JTextField();
        vehicleLicensePlateBox = new javax.swing.JTextField();
        vehicleOwnerSSNBox = new javax.swing.JTextField();
        vehicleYearBox = new javax.swing.JTextField();
        vehicleMakeBox = new javax.swing.JTextField();
        vehicleModelBox = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        vehicleSearchLicensePlateBox = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        vehicleAddButton = new javax.swing.JButton();
        vehicleUpdateButton = new javax.swing.JButton();
        vehicleDeleteButton = new javax.swing.JButton();
        jLabel54 = new javax.swing.JLabel();
        jLabel55 = new javax.swing.JLabel();
        jLabel57 = new javax.swing.JLabel();
        jLabel56 = new javax.swing.JLabel();
        jLabel58 = new javax.swing.JLabel();
        jLabel71 = new javax.swing.JLabel();
        employeePanel = new javax.swing.JPanel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        employeeSearchButton = new javax.swing.JButton();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        employeeSearchDropBox = new javax.swing.JComboBox();
        jLabel23 = new javax.swing.JLabel();
        employeeSearchBox = new javax.swing.JTextField();
        employeeSSNBox = new javax.swing.JTextField();
        employeeFirstNameBox = new javax.swing.JTextField();
        employeeLastNameBox = new javax.swing.JTextField();
        employeePhoneNumberBox = new javax.swing.JTextField();
        employeePositionBox = new javax.swing.JTextField();
        employeeAddressBox = new javax.swing.JTextField();
        employeeCityBox = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        employeeStateBox = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        employeeZipBox = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        employeeAddButton = new javax.swing.JButton();
        employeeUpdateButton = new javax.swing.JButton();
        employeeDeleteButton = new javax.swing.JButton();
        jLabel59 = new javax.swing.JLabel();
        jLabel60 = new javax.swing.JLabel();
        jLabel61 = new javax.swing.JLabel();
        jLabel62 = new javax.swing.JLabel();
        emergencyContactPanel = new javax.swing.JPanel();
        jLabel24 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        emergencyContactSearchButton = new javax.swing.JButton();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        emergencyContactSearchBox = new javax.swing.JTextField();
        emergencyContactFirstNameBox = new javax.swing.JTextField();
        emergencyContactLastNameBox = new javax.swing.JTextField();
        emergencyContactPhoneNumberBox = new javax.swing.JTextField();
        emergencyContactTenantSSNBox = new javax.swing.JTextField();
        jLabel34 = new javax.swing.JLabel();
        emergAddButton = new javax.swing.JButton();
        emergUpdatebutton = new javax.swing.JButton();
        emergDeleteButton = new javax.swing.JButton();
        jLabel63 = new javax.swing.JLabel();
        jLabel64 = new javax.swing.JLabel();
        jLabel65 = new javax.swing.JLabel();
        jLabel66 = new javax.swing.JLabel();
        billPanel = new javax.swing.JPanel();
        jLabel28 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        billSearchButton = new javax.swing.JButton();
        jLabel35 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        jLabel37 = new javax.swing.JLabel();
        billSSNSearchBox = new javax.swing.JTextField();
        billSSNBox = new javax.swing.JTextField();
        billDateBox = new javax.swing.JTextField();
        billPaymentDateBox = new javax.swing.JTextField();
        billAmountBox = new javax.swing.JTextField();
        jLabel41 = new javax.swing.JLabel();
        billTypeDropBox = new javax.swing.JComboBox();
        billAddButton = new javax.swing.JButton();
        billUpdateButton = new javax.swing.JButton();
        billDeleteButton = new javax.swing.JButton();
        jLabel32 = new javax.swing.JLabel();
        jLabel38 = new javax.swing.JLabel();
        jLabel39 = new javax.swing.JLabel();
        jLabel40 = new javax.swing.JLabel();
        writeUpPanel = new javax.swing.JPanel();
        jLabel44 = new javax.swing.JLabel();
        writeUpSearchButton = new javax.swing.JButton();
        jLabel45 = new javax.swing.JLabel();
        jLabel46 = new javax.swing.JLabel();
        jLabel47 = new javax.swing.JLabel();
        writeUpSSNSearchBox = new javax.swing.JTextField();
        writeUpSSNBox = new javax.swing.JTextField();
        writeUpDateBox = new javax.swing.JTextField();
        jLabel48 = new javax.swing.JLabel();
        writeUpTypeDropBox = new javax.swing.JComboBox();
        jScrollPane2 = new javax.swing.JScrollPane();
        writeUpDescriptionBox = new javax.swing.JTextArea();
        writeUpAddButton = new javax.swing.JButton();
        writeUpUpdateButton = new javax.swing.JButton();
        writeUpDeleteButton = new javax.swing.JButton();
        jLabel67 = new javax.swing.JLabel();
        jLabel68 = new javax.swing.JLabel();
        jLabel69 = new javax.swing.JLabel();
        jLabel70 = new javax.swing.JLabel();
        paymentInfoPanel = new javax.swing.JPanel();
        jLabel85 = new javax.swing.JLabel();
        jLabel87 = new javax.swing.JLabel();
        paySearchButton = new javax.swing.JButton();
        jLabel88 = new javax.swing.JLabel();
        jLabel89 = new javax.swing.JLabel();
        paySearchBox = new javax.swing.JTextField();
        paySSNBox = new javax.swing.JTextField();
        payRoutingNumBox = new javax.swing.JTextField();
        payAcctNumBox = new javax.swing.JTextField();
        payAddButton = new javax.swing.JButton();
        payUpdateButton = new javax.swing.JButton();
        payDeleteButton = new javax.swing.JButton();
        jLabel94 = new javax.swing.JLabel();
        jLabel95 = new javax.swing.JLabel();
        jLabel97 = new javax.swing.JLabel();
        jLabel72 = new javax.swing.JLabel();
        payTypeBox = new javax.swing.JComboBox();
        tablePane = new javax.swing.JScrollPane();
        table = new javax.swing.JTable();

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        selectionBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Bills", "Emergency Contacts", "Employees", "Lease", "Payment Info", "Tenants", "Utilities", "Vehicle", "Write Ups" }));
        selectionBox.setSelectedIndex(5);
        selectionBox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                selectionBoxItemStateChanged(evt);
            }
        });
        selectionBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                selectionBoxActionPerformed(evt);
            }
        });

        showAllButton.setText("Show All");
        showAllButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                showAllButtonMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(selectionBox, 0, 100, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(showAllButton)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(selectionBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 127, Short.MAX_VALUE)
                .addComponent(showAllButton)
                .addGap(21, 21, 21))
        );

        backButton.setText("Back");
        backButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                backButtonMouseClicked(evt);
            }
        });

        informationPane.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Information", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 18))); // NOI18N

        jLabel74.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel74.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel74.setText("SSN:");

        leaseSearchButton.setText("Search");
        leaseSearchButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                leaseSearchButtonMouseClicked(evt);
            }
        });

        jLabel75.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel75.setText("Type:");

        leaseTypeDropBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Promo", "Regular" }));
        leaseTypeDropBox.setSelectedIndex(1);

        jLabel77.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel77.setText("Start Date:");

        leaseAddButton.setText("Add");
        leaseAddButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                leaseAddButtonMouseClicked(evt);
            }
        });

        leaseUpdateButton.setText("Update");
        leaseUpdateButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                leaseUpdateButtonMouseClicked(evt);
            }
        });

        leaseDeleteButton.setText("Delete");
        leaseDeleteButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                leaseDeleteButtonMouseClicked(evt);
            }
        });

        jLabel81.setForeground(new java.awt.Color(255, 51, 51));
        jLabel81.setText("*");

        jLabel83.setForeground(new java.awt.Color(255, 51, 51));
        jLabel83.setText("*");

        jLabel111.setText("SSN:");

        javax.swing.GroupLayout leasePanelLayout = new javax.swing.GroupLayout(leasePanel);
        leasePanel.setLayout(leasePanelLayout);
        leasePanelLayout.setHorizontalGroup(
            leasePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(leasePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(leaseSearchButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel111)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(leaseSSNSearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(229, 229, 229)
                .addComponent(leaseAddButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(leaseUpdateButton)
                .addGap(18, 18, 18)
                .addComponent(leaseDeleteButton)
                .addContainerGap(103, Short.MAX_VALUE))
            .addGroup(leasePanelLayout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addGroup(leasePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel74)
                    .addComponent(jLabel75)
                    .addComponent(jLabel77))
                .addGroup(leasePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(leasePanelLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel81))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, leasePanelLayout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jLabel83, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(leasePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(leaseSSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(leaseTypeDropBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(leaseStartDateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 0, Short.MAX_VALUE))
        );
        leasePanelLayout.setVerticalGroup(
            leasePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, leasePanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(leasePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(leaseSSNSearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(leaseSearchButton)
                    .addComponent(leaseAddButton)
                    .addComponent(leaseUpdateButton)
                    .addComponent(leaseDeleteButton)
                    .addComponent(jLabel111))
                .addGap(18, 18, 18)
                .addGroup(leasePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel74)
                    .addComponent(leaseSSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel81))
                .addGap(18, 18, 18)
                .addGroup(leasePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel75)
                    .addComponent(leaseTypeDropBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(24, 24, 24)
                .addGroup(leasePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(leasePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel77)
                        .addComponent(jLabel83))
                    .addComponent(leaseStartDateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(43, 43, 43))
        );

        leasePanel.setBounds(10, 30, 810, 190);
        informationPane.add(leasePanel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        informationPane.setLayer(tenantPanel, javax.swing.JLayeredPane.DEFAULT_LAYER,1);

        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel5.setText("Phone Number:");

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel2.setText("Apt Number:");

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel1.setText("SSN:");

        tenantSearchButton.setText("Search");
        tenantSearchButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tenantSearchButtonMouseClicked(evt);
            }
        });

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel3.setText("First Name:");

        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel6.setText("Email:");

        tenantSearchDropBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Apt Number", "Last Name", "SSN" }));

        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel4.setText("Last Name:");

        tenantAddButton.setText("Add");
        tenantAddButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tenantAddButtonMouseClicked(evt);
            }
        });

        tenantUpdateButton.setText("Update");
        tenantUpdateButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tenantUpdateButtonMouseClicked(evt);
            }
        });
        tenantUpdateButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tenantUpdateButtonActionPerformed(evt);
            }
        });

        tenantDeleteButton.setText("Delete");
        tenantDeleteButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tenantDeleteButtonMouseClicked(evt);
            }
        });

        jLabel42.setForeground(new java.awt.Color(255, 51, 51));
        jLabel42.setText("*");

        jLabel43.setForeground(new java.awt.Color(255, 51, 51));
        jLabel43.setText("*");

        jLabel49.setForeground(new java.awt.Color(255, 51, 51));
        jLabel49.setText("*");

        jLabel50.setForeground(new java.awt.Color(255, 51, 51));
        jLabel50.setText("*");

        javax.swing.GroupLayout tenantPanelLayout = new javax.swing.GroupLayout(tenantPanel);
        tenantPanel.setLayout(tenantPanelLayout);
        tenantPanelLayout.setHorizontalGroup(
            tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tenantPanelLayout.createSequentialGroup()
                .addGap(66, 66, 66)
                .addGroup(tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(tenantPanelLayout.createSequentialGroup()
                        .addGroup(tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel1)
                            .addGroup(tenantPanelLayout.createSequentialGroup()
                                .addComponent(tenantSearchButton)
                                .addGap(18, 18, 18)
                                .addComponent(tenantSearchDropBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel42))
                    .addGroup(tenantPanelLayout.createSequentialGroup()
                        .addGroup(tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel43)
                            .addComponent(jLabel49))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tenantPanelLayout.createSequentialGroup()
                        .addGroup(tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(tenantPanelLayout.createSequentialGroup()
                                .addComponent(tenantLastNameBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel2))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tenantPanelLayout.createSequentialGroup()
                                .addComponent(tenantSSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel5))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tenantPanelLayout.createSequentialGroup()
                                .addComponent(tenantFirstNameBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel6)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel50)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tenantPhoneNumberBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tenantEmailBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tenantAptNumberBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(159, Short.MAX_VALUE))
                    .addGroup(tenantPanelLayout.createSequentialGroup()
                        .addComponent(tenantSearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(56, 56, 56)
                        .addComponent(tenantAddButton)
                        .addGap(18, 18, 18)
                        .addComponent(tenantUpdateButton)
                        .addGap(18, 18, 18)
                        .addComponent(tenantDeleteButton)
                        .addContainerGap(139, Short.MAX_VALUE))))
        );
        tenantPanelLayout.setVerticalGroup(
            tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tenantPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tenantSearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tenantSearchDropBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tenantSearchButton)
                    .addComponent(tenantAddButton)
                    .addComponent(tenantUpdateButton)
                    .addComponent(tenantDeleteButton))
                .addGap(18, 18, 18)
                .addGroup(tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel1)
                    .addComponent(tenantSSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tenantPhoneNumberBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel42))
                .addGap(18, 18, 18)
                .addGroup(tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel6)
                    .addComponent(tenantFirstNameBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tenantEmailBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel43))
                .addGap(18, 18, 18)
                .addGroup(tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tenantPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel4)
                        .addComponent(jLabel2)
                        .addComponent(tenantLastNameBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(tenantAptNumberBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel49))
                    .addComponent(jLabel50))
                .addGap(46, 46, 46))
        );

        tenantPanel.setBounds(10, 30, 810, 190);
        informationPane.add(tenantPanel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel7.setText("Type:");

        jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel8.setText("Provider:");

        jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel9.setText("Cost:");

        utilitiesTypeBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Electric", "Gas" }));

        utilitiesAdd.setText("Add");
        utilitiesAdd.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                utilitiesAddMouseClicked(evt);
            }
        });

        utilitiesUpdate.setText("Update");
        utilitiesUpdate.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                utilitiesUpdateMouseClicked(evt);
            }
        });

        utilitiesDelete.setText("Delete");
        utilitiesDelete.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                utilitiesDeleteMouseClicked(evt);
            }
        });

        jLabel51.setForeground(new java.awt.Color(255, 51, 102));
        jLabel51.setText("*");

        jLabel52.setForeground(new java.awt.Color(255, 51, 102));
        jLabel52.setText("*");

        jLabel53.setForeground(new java.awt.Color(255, 51, 102));
        jLabel53.setText("*");

        javax.swing.GroupLayout utilitiesPanelLayout = new javax.swing.GroupLayout(utilitiesPanel);
        utilitiesPanel.setLayout(utilitiesPanelLayout);
        utilitiesPanelLayout.setHorizontalGroup(
            utilitiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(utilitiesPanelLayout.createSequentialGroup()
                .addGroup(utilitiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(utilitiesPanelLayout.createSequentialGroup()
                        .addGap(57, 57, 57)
                        .addGroup(utilitiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                            .addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(utilitiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel52)
                            .addComponent(jLabel53)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, utilitiesPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel51)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(utilitiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(utilitiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(utilitiesCostBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(utilitiesProviderBox, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(utilitiesPanelLayout.createSequentialGroup()
                        .addComponent(utilitiesTypeBox, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(89, 89, 89)
                        .addComponent(utilitiesAdd)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(utilitiesUpdate)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(utilitiesDelete)))
                .addContainerGap(228, Short.MAX_VALUE))
        );
        utilitiesPanelLayout.setVerticalGroup(
            utilitiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(utilitiesPanelLayout.createSequentialGroup()
                .addGap(36, 36, 36)
                .addGroup(utilitiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(utilitiesTypeBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(utilitiesAdd)
                    .addComponent(utilitiesUpdate)
                    .addComponent(utilitiesDelete)
                    .addComponent(jLabel51))
                .addGap(18, 18, 18)
                .addGroup(utilitiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(utilitiesProviderBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel52))
                .addGap(18, 18, 18)
                .addGroup(utilitiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(utilitiesCostBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel53))
                .addContainerGap(65, Short.MAX_VALUE))
        );

        utilitiesPanel.setBounds(10, 20, 810, 200);
        informationPane.add(utilitiesPanel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel10.setText("Year:");

        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel11.setText("Model:");

        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel12.setText("State:");

        vehicleSearchButton.setText("Search");
        vehicleSearchButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                vehicleSearchButtonMouseClicked(evt);
            }
        });

        jLabel13.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel13.setText("License Plate:");

        jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel14.setText("Make:");

        jLabel15.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel15.setText("Owner SSN:");

        jLabel16.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel16.setText("License Plate:");

        jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel17.setText("State:");

        vehicleAddButton.setText("Add");
        vehicleAddButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                vehicleAddButtonMouseClicked(evt);
            }
        });

        vehicleUpdateButton.setText("Update");
        vehicleUpdateButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                vehicleUpdateButtonMouseClicked(evt);
            }
        });

        vehicleDeleteButton.setText("Delete");
        vehicleDeleteButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                vehicleDeleteButtonMouseClicked(evt);
            }
        });

        jLabel54.setForeground(new java.awt.Color(255, 51, 102));
        jLabel54.setText("*");

        jLabel55.setForeground(new java.awt.Color(255, 51, 102));
        jLabel55.setText("*");

        jLabel57.setForeground(new java.awt.Color(255, 51, 51));
        jLabel57.setText("*");

        jLabel56.setForeground(new java.awt.Color(255, 51, 51));
        jLabel56.setText("*");

        jLabel58.setForeground(new java.awt.Color(255, 51, 51));
        jLabel58.setText("*");

        jLabel71.setForeground(new java.awt.Color(255, 51, 102));
        jLabel71.setText("*");

        javax.swing.GroupLayout vehiclePanelLayout = new javax.swing.GroupLayout(vehiclePanel);
        vehiclePanel.setLayout(vehiclePanelLayout);
        vehiclePanelLayout.setHorizontalGroup(
            vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, vehiclePanelLayout.createSequentialGroup()
                .addGroup(vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(vehiclePanelLayout.createSequentialGroup()
                        .addGap(122, 122, 122)
                        .addGroup(vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, vehiclePanelLayout.createSequentialGroup()
                                .addComponent(jLabel12)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel54)
                                .addGap(5, 5, 5))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, vehiclePanelLayout.createSequentialGroup()
                                .addGroup(vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel13)
                                    .addComponent(jLabel15))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel55)
                                    .addComponent(jLabel71))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(vehicleOwnerSSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(vehicleStateBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(vehicleLicensePlateBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(42, 42, 42)
                        .addGroup(vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(vehiclePanelLayout.createSequentialGroup()
                                .addGap(6, 6, 6)
                                .addComponent(jLabel10))
                            .addComponent(jLabel14, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel57)
                            .addComponent(jLabel56)
                            .addComponent(jLabel58))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(vehicleMakeBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(vehicleModelBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(vehicleYearBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(vehiclePanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(vehicleSearchButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel17)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vehicleSearchStateBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel16)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vehicleSearchLicensePlateBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(vehicleAddButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vehicleUpdateButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vehicleDeleteButton)))
                .addContainerGap(98, Short.MAX_VALUE))
        );
        vehiclePanelLayout.setVerticalGroup(
            vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, vehiclePanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(vehicleSearchStateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vehicleSearchButton)
                    .addComponent(jLabel16)
                    .addComponent(vehicleSearchLicensePlateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17)
                    .addComponent(vehicleAddButton)
                    .addComponent(vehicleUpdateButton)
                    .addComponent(vehicleDeleteButton))
                .addGap(40, 40, 40)
                .addGroup(vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(jLabel12)
                    .addComponent(vehicleStateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vehicleYearBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel54)
                    .addComponent(jLabel57))
                .addGap(18, 18, 18)
                .addGroup(vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(jLabel14)
                    .addComponent(vehicleLicensePlateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vehicleMakeBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel55)
                    .addComponent(jLabel56))
                .addGap(18, 18, 18)
                .addGroup(vehiclePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(jLabel11)
                    .addComponent(vehicleOwnerSSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vehicleModelBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel58)
                    .addComponent(jLabel71))
                .addGap(30, 30, 30))
        );

        vehiclePanel.setBounds(10, 30, 810, 190);
        informationPane.add(vehiclePanel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        informationPane.setLayer(tenantPanel, javax.swing.JLayeredPane.DEFAULT_LAYER,1);

        jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel18.setText("Phone Number:");

        jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel19.setText("Address:");

        jLabel20.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel20.setText("SSN:");

        employeeSearchButton.setText("Search");
        employeeSearchButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                employeeSearchButtonMouseClicked(evt);
            }
        });

        jLabel21.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel21.setText("First Name:");

        jLabel22.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel22.setText("Position:");

        employeeSearchDropBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Last Name", "SSN" }));

        jLabel23.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel23.setText("Last Name:");

        jLabel25.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel25.setText("City:");

        jLabel26.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel26.setText("State:");

        jLabel27.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel27.setText("Zip:");

        employeeAddButton.setText("Add");
        employeeAddButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                employeeAddButtonMouseClicked(evt);
            }
        });

        employeeUpdateButton.setText("Update");
        employeeUpdateButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                employeeUpdateButtonMouseClicked(evt);
            }
        });

        employeeDeleteButton.setText("Delete");
        employeeDeleteButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                employeeDeleteButtonMouseClicked(evt);
            }
        });

        jLabel59.setForeground(new java.awt.Color(255, 51, 51));
        jLabel59.setText("*");

        jLabel60.setForeground(new java.awt.Color(255, 51, 51));
        jLabel60.setText("*");

        jLabel61.setForeground(new java.awt.Color(255, 51, 51));
        jLabel61.setText("*");

        jLabel62.setForeground(new java.awt.Color(255, 51, 51));
        jLabel62.setText("*");

        javax.swing.GroupLayout employeePanelLayout = new javax.swing.GroupLayout(employeePanel);
        employeePanel.setLayout(employeePanelLayout);
        employeePanelLayout.setHorizontalGroup(
            employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(employeePanelLayout.createSequentialGroup()
                .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(employeePanelLayout.createSequentialGroup()
                        .addGap(88, 88, 88)
                        .addComponent(employeeSearchButton)
                        .addGap(18, 18, 18)
                        .addComponent(employeeSearchDropBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(employeeSearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(47, 47, 47)
                        .addComponent(employeeAddButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(employeeUpdateButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(employeeDeleteButton))
                    .addGroup(employeePanelLayout.createSequentialGroup()
                        .addGap(39, 39, 39)
                        .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel20)
                            .addComponent(jLabel21)
                            .addComponent(jLabel23))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel60, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel59, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel61, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(employeePanelLayout.createSequentialGroup()
                                .addComponent(employeeLastNameBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel19))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, employeePanelLayout.createSequentialGroup()
                                .addComponent(employeeSSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel22))
                            .addGroup(employeePanelLayout.createSequentialGroup()
                                .addComponent(employeeFirstNameBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel18)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel62)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(employeePanelLayout.createSequentialGroup()
                                .addComponent(employeePhoneNumberBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel26)
                                .addGap(18, 18, 18)
                                .addComponent(employeeStateBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(employeePanelLayout.createSequentialGroup()
                                .addComponent(employeePositionBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(26, 26, 26)
                                .addComponent(jLabel25)
                                .addGap(18, 18, 18)
                                .addComponent(employeeCityBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(employeePanelLayout.createSequentialGroup()
                                .addComponent(employeeAddressBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(32, 32, 32)
                                .addComponent(jLabel27)
                                .addGap(18, 18, 18)
                                .addComponent(employeeZipBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(81, 81, 81))
        );
        employeePanelLayout.setVerticalGroup(
            employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, employeePanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(employeeSearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(employeeSearchDropBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(employeeSearchButton)
                    .addComponent(employeeAddButton)
                    .addComponent(employeeUpdateButton)
                    .addComponent(employeeDeleteButton))
                .addGap(18, 18, 18)
                .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel25)
                        .addComponent(employeeCityBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel20)
                        .addComponent(employeeSSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel22)
                        .addComponent(employeePositionBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel59)
                        .addComponent(jLabel62)))
                .addGap(18, 18, 18)
                .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel26)
                        .addComponent(employeeStateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel21)
                        .addComponent(employeeFirstNameBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel18)
                        .addComponent(employeePhoneNumberBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel60)))
                .addGap(18, 18, 18)
                .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel27)
                        .addComponent(employeeZipBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(employeePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel23)
                        .addComponent(jLabel19)
                        .addComponent(employeeLastNameBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(employeeAddressBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel61)))
                .addGap(46, 46, 46))
        );

        employeePanel.setBounds(10, 30, 810, 190);
        informationPane.add(employeePanel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        informationPane.setLayer(tenantPanel, javax.swing.JLayeredPane.DEFAULT_LAYER,1);

        jLabel24.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel24.setText("Phone Number:");

        jLabel29.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel29.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel29.setText("First Name:");

        emergencyContactSearchButton.setText("Search");
        emergencyContactSearchButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                emergencyContactSearchButtonMouseClicked(evt);
            }
        });

        jLabel30.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel30.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel30.setText("Last Name:");

        jLabel31.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel31.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel31.setText("Tenant SSN:");

        jLabel34.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel34.setText("Tenant SSN:");

        emergAddButton.setText("Add");
        emergAddButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                emergAddButtonMouseClicked(evt);
            }
        });

        emergUpdatebutton.setText("Update");
        emergUpdatebutton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                emergUpdatebuttonMouseClicked(evt);
            }
        });

        emergDeleteButton.setText("Delete");
        emergDeleteButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                emergDeleteButtonMouseClicked(evt);
            }
        });

        jLabel63.setForeground(new java.awt.Color(255, 51, 51));
        jLabel63.setText("*");

        jLabel64.setForeground(new java.awt.Color(255, 51, 51));
        jLabel64.setText("*");

        jLabel65.setForeground(new java.awt.Color(255, 51, 51));
        jLabel65.setText("*");

        jLabel66.setForeground(new java.awt.Color(255, 51, 51));
        jLabel66.setText("*");

        javax.swing.GroupLayout emergencyContactPanelLayout = new javax.swing.GroupLayout(emergencyContactPanel);
        emergencyContactPanel.setLayout(emergencyContactPanelLayout);
        emergencyContactPanelLayout.setHorizontalGroup(
            emergencyContactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(emergencyContactPanelLayout.createSequentialGroup()
                .addGap(66, 66, 66)
                .addGroup(emergencyContactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(emergencyContactPanelLayout.createSequentialGroup()
                        .addComponent(emergencyContactSearchButton)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel34)
                        .addGap(18, 18, 18)
                        .addComponent(emergencyContactSearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(emergencyContactPanelLayout.createSequentialGroup()
                        .addGroup(emergencyContactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, emergencyContactPanelLayout.createSequentialGroup()
                                .addComponent(jLabel29)
                                .addGap(2, 2, 2))
                            .addGroup(emergencyContactPanelLayout.createSequentialGroup()
                                .addComponent(jLabel30)
                                .addGap(8, 8, 8)))
                        .addGroup(emergencyContactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(emergencyContactPanelLayout.createSequentialGroup()
                                .addComponent(jLabel64)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(emergencyContactLastNameBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(emergencyContactPanelLayout.createSequentialGroup()
                                .addComponent(jLabel63)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(emergencyContactFirstNameBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGroup(emergencyContactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(emergencyContactPanelLayout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addGroup(emergencyContactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel24)
                            .addComponent(jLabel31))
                        .addGap(1, 1, 1)
                        .addGroup(emergencyContactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel65)
                            .addComponent(jLabel66))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(emergencyContactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(emergencyContactPhoneNumberBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(emergencyContactTenantSSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(emergencyContactPanelLayout.createSequentialGroup()
                        .addGap(112, 112, 112)
                        .addComponent(emergAddButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(emergUpdatebutton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(emergDeleteButton)))
                .addContainerGap(123, Short.MAX_VALUE))
        );
        emergencyContactPanelLayout.setVerticalGroup(
            emergencyContactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, emergencyContactPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(emergencyContactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(emergencyContactSearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(emergencyContactSearchButton)
                    .addComponent(jLabel34)
                    .addComponent(emergAddButton)
                    .addComponent(emergUpdatebutton)
                    .addComponent(emergDeleteButton))
                .addGap(34, 34, 34)
                .addGroup(emergencyContactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel24)
                    .addComponent(jLabel29)
                    .addComponent(emergencyContactFirstNameBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(emergencyContactPhoneNumberBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel63)
                    .addComponent(jLabel65))
                .addGap(18, 18, 18)
                .addGroup(emergencyContactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel30)
                    .addComponent(jLabel31)
                    .addComponent(emergencyContactLastNameBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(emergencyContactTenantSSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel64)
                    .addComponent(jLabel66))
                .addGap(68, 68, 68))
        );

        emergencyContactPanel.setBounds(10, 30, 810, 190);
        informationPane.add(emergencyContactPanel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        informationPane.setLayer(tenantPanel, javax.swing.JLayeredPane.DEFAULT_LAYER,1);

        jLabel28.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel28.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel28.setText("Payment Date:");

        jLabel33.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel33.setText("SSN:");

        billSearchButton.setText("Search");
        billSearchButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                billSearchButtonMouseClicked(evt);
            }
        });

        jLabel35.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel35.setText("Type:");

        jLabel36.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel36.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel36.setText("Amount:");

        jLabel37.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel37.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel37.setText("Date:");

        jLabel41.setText("Tenant SSN:");

        billTypeDropBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Fee", "Rent", "Other" }));
        billTypeDropBox.setSelectedIndex(1);

        billAddButton.setText("Add");
        billAddButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                billAddButtonMouseClicked(evt);
            }
        });

        billUpdateButton.setText("Update");
        billUpdateButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                billUpdateButtonMouseClicked(evt);
            }
        });

        billDeleteButton.setText("Delete");
        billDeleteButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                billDeleteButtonMouseClicked(evt);
            }
        });

        jLabel32.setForeground(new java.awt.Color(255, 51, 51));
        jLabel32.setText("*");
        jLabel32.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);

        jLabel38.setForeground(new java.awt.Color(255, 51, 51));
        jLabel38.setText("*");

        jLabel39.setForeground(new java.awt.Color(255, 51, 51));
        jLabel39.setText("*");

        jLabel40.setForeground(new java.awt.Color(255, 51, 51));
        jLabel40.setText("*");

        javax.swing.GroupLayout billPanelLayout = new javax.swing.GroupLayout(billPanel);
        billPanel.setLayout(billPanelLayout);
        billPanelLayout.setHorizontalGroup(
            billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(billPanelLayout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel33)
                    .addComponent(jLabel35)
                    .addComponent(jLabel37))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel39, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel40, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(17, 17, 17)
                .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(billDateBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(billTypeDropBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(billSSNBox, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)))
                .addGap(18, 18, 18)
                .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel28)
                    .addComponent(jLabel36))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel32, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel38, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(billAmountBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(billPaymentDateBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, billPanelLayout.createSequentialGroup()
                .addGap(0, 69, Short.MAX_VALUE)
                .addComponent(billSearchButton)
                .addGap(18, 18, 18)
                .addComponent(jLabel41)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(billSSNSearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(150, 150, 150)
                .addComponent(billAddButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(billUpdateButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(billDeleteButton)
                .addGap(96, 96, 96))
        );
        billPanelLayout.setVerticalGroup(
            billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, billPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(billSSNSearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(billSearchButton)
                    .addComponent(jLabel41)
                    .addComponent(billAddButton)
                    .addComponent(billUpdateButton)
                    .addComponent(billDeleteButton))
                .addGap(18, 18, 18)
                .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel35)
                    .addComponent(billTypeDropBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28)
                .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel36)
                        .addComponent(billAmountBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(billSSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel33)
                        .addComponent(jLabel32)
                        .addComponent(jLabel40))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, billPanelLayout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel28)
                                .addComponent(billPaymentDateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel38))
                            .addGroup(billPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel37)
                                .addComponent(billDateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel39)))))
                .addGap(46, 46, 46))
        );

        billPanel.setBounds(10, 30, 810, 190);
        informationPane.add(billPanel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        informationPane.setLayer(tenantPanel, javax.swing.JLayeredPane.DEFAULT_LAYER,1);

        jLabel44.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel44.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel44.setText("SSN:");

        writeUpSearchButton.setText("Search");
        writeUpSearchButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                writeUpSearchButtonMouseClicked(evt);
            }
        });

        jLabel45.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel45.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel45.setText("Type:");

        jLabel46.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel46.setText("Description:");

        jLabel47.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel47.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel47.setText("Date:");

        jLabel48.setText("Employee SSN:");

        writeUpTypeDropBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Accident", "Complaint", "General", "Other" }));

        writeUpDescriptionBox.setColumns(20);
        writeUpDescriptionBox.setFont(new java.awt.Font("Tahoma", 0, 11)); // NOI18N
        writeUpDescriptionBox.setLineWrap(true);
        writeUpDescriptionBox.setRows(5);
        jScrollPane2.setViewportView(writeUpDescriptionBox);

        writeUpAddButton.setText("Add");
        writeUpAddButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                writeUpAddButtonMouseClicked(evt);
            }
        });

        writeUpUpdateButton.setText("Update");
        writeUpUpdateButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                writeUpUpdateButtonMouseClicked(evt);
            }
        });

        writeUpDeleteButton.setText("Delete");
        writeUpDeleteButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                writeUpDeleteButtonMouseClicked(evt);
            }
        });

        jLabel67.setForeground(new java.awt.Color(255, 51, 51));
        jLabel67.setText("*");

        jLabel68.setForeground(new java.awt.Color(255, 51, 51));
        jLabel68.setText("*");

        jLabel69.setForeground(new java.awt.Color(255, 51, 51));
        jLabel69.setText("*");

        jLabel70.setForeground(new java.awt.Color(255, 51, 51));
        jLabel70.setText("*");

        javax.swing.GroupLayout writeUpPanelLayout = new javax.swing.GroupLayout(writeUpPanel);
        writeUpPanel.setLayout(writeUpPanelLayout);
        writeUpPanelLayout.setHorizontalGroup(
            writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, writeUpPanelLayout.createSequentialGroup()
                .addGroup(writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(writeUpPanelLayout.createSequentialGroup()
                        .addGap(0, 17, Short.MAX_VALUE)
                        .addComponent(writeUpSearchButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel48)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(writeUpSSNSearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                    .addGroup(writeUpPanelLayout.createSequentialGroup()
                        .addGroup(writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(writeUpPanelLayout.createSequentialGroup()
                                .addGap(11, 11, 11)
                                .addComponent(jLabel47)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel69))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, writeUpPanelLayout.createSequentialGroup()
                                .addContainerGap()
                                .addGroup(writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel44)
                                    .addComponent(jLabel45))
                                .addGroup(writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(writeUpPanelLayout.createSequentialGroup()
                                        .addGap(5, 5, 5)
                                        .addComponent(jLabel67))
                                    .addGroup(writeUpPanelLayout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel68)))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(writeUpDateBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(writeUpTypeDropBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(writeUpSSNBox, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)))
                        .addGap(45, 45, 45)))
                .addGroup(writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(writeUpPanelLayout.createSequentialGroup()
                        .addComponent(jLabel46)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel70)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 269, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(139, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, writeUpPanelLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(writeUpAddButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(writeUpUpdateButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(writeUpDeleteButton)
                        .addGap(114, 114, 114))))
        );
        writeUpPanelLayout.setVerticalGroup(
            writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, writeUpPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(writeUpSSNSearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(writeUpSearchButton)
                    .addComponent(jLabel48)
                    .addComponent(writeUpAddButton)
                    .addComponent(writeUpUpdateButton)
                    .addComponent(writeUpDeleteButton))
                .addGap(18, 18, 18)
                .addGroup(writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(writeUpPanelLayout.createSequentialGroup()
                        .addGroup(writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel46)
                            .addComponent(jLabel45)
                            .addComponent(writeUpTypeDropBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel67)
                            .addComponent(jLabel70))
                        .addGap(18, 18, 18)
                        .addGroup(writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel44)
                            .addComponent(writeUpSSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel68))
                        .addGap(27, 27, 27)
                        .addGroup(writeUpPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel47)
                            .addComponent(writeUpDateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel69)))
                    .addComponent(jScrollPane2))
                .addGap(46, 46, 46))
        );

        writeUpPanel.setBounds(10, 30, 810, 190);
        informationPane.add(writeUpPanel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        informationPane.setLayer(tenantPanel, javax.swing.JLayeredPane.DEFAULT_LAYER,1);

        jLabel85.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel85.setText("Account Number:");

        jLabel87.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel87.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel87.setText("SSN:");

        paySearchButton.setText("Search");
        paySearchButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                paySearchButtonMouseClicked(evt);
            }
        });

        jLabel88.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel88.setText("Routing Number:");

        jLabel89.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel89.setText("Account Type:");

        payAddButton.setText("Add");
        payAddButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                payAddButtonMouseClicked(evt);
            }
        });

        payUpdateButton.setText("Update");
        payUpdateButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                payUpdateButtonMouseClicked(evt);
            }
        });

        payDeleteButton.setText("Delete");
        payDeleteButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                payDeleteButtonMouseClicked(evt);
            }
        });

        jLabel94.setForeground(new java.awt.Color(255, 51, 51));
        jLabel94.setText("*");

        jLabel95.setForeground(new java.awt.Color(255, 51, 51));
        jLabel95.setText("*");

        jLabel97.setForeground(new java.awt.Color(255, 51, 51));
        jLabel97.setText("*");

        jLabel72.setText("SSN:");

        payTypeBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Checking", "Savings" }));

        javax.swing.GroupLayout paymentInfoPanelLayout = new javax.swing.GroupLayout(paymentInfoPanel);
        paymentInfoPanel.setLayout(paymentInfoPanelLayout);
        paymentInfoPanelLayout.setHorizontalGroup(
            paymentInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(paymentInfoPanelLayout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addGroup(paymentInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel87)
                    .addComponent(jLabel88))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(paymentInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel95, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel94, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(paymentInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, paymentInfoPanelLayout.createSequentialGroup()
                        .addComponent(paySSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel89))
                    .addGroup(paymentInfoPanelLayout.createSequentialGroup()
                        .addComponent(payRoutingNumBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel85)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel97)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(paymentInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(payAcctNumBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(payTypeBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(313, 313, 313))
            .addGroup(paymentInfoPanelLayout.createSequentialGroup()
                .addGap(88, 88, 88)
                .addComponent(paySearchButton)
                .addGap(61, 61, 61)
                .addComponent(jLabel72)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(paySearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(47, 47, 47)
                .addComponent(payAddButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(payUpdateButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(payDeleteButton)
                .addGap(197, 197, 197))
        );
        paymentInfoPanelLayout.setVerticalGroup(
            paymentInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, paymentInfoPanelLayout.createSequentialGroup()
                .addGap(18, 18, Short.MAX_VALUE)
                .addGroup(paymentInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(paySearchBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(paySearchButton)
                    .addComponent(payAddButton)
                    .addComponent(payUpdateButton)
                    .addComponent(payDeleteButton)
                    .addComponent(jLabel72))
                .addGap(18, 18, 18)
                .addGroup(paymentInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel87)
                    .addComponent(paySSNBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel89)
                    .addComponent(jLabel94)
                    .addComponent(payTypeBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(paymentInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel88)
                    .addComponent(payRoutingNumBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel85)
                    .addComponent(payAcctNumBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel95)
                    .addComponent(jLabel97, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(80, 80, 80))
        );

        paymentInfoPanel.setBounds(10, 30, 810, 190);
        informationPane.add(paymentInfoPanel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        informationPane.setLayer(tenantPanel, javax.swing.JLayeredPane.DEFAULT_LAYER,1);

        table.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tableMouseClicked(evt);
            }
        });
        tablePane.setViewportView(table);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(tablePane, javax.swing.GroupLayout.DEFAULT_SIZE, 714, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(backButton)
                        .addGap(13, 13, 13))
                    .addComponent(informationPane, javax.swing.GroupLayout.Alignment.LEADING))
                .addGap(19, 19, 19))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(tablePane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addGap(18, 18, Short.MAX_VALUE)
                .addComponent(informationPane, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(backButton)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void selectionBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectionBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_selectionBoxActionPerformed

    private void backButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_backButtonMouseClicked
              
        //create main window
        MainMenu main = new MainMenu();
        main.setLocation(MainMenu.X, MainMenu.Y);
        main.setVisible(true);
                
        //close this window
        this.dispose();     
        
    }//GEN-LAST:event_backButtonMouseClicked

    private void fillBoxes(String[] row) throws ParseException
    {
        int index = selectionBox.getSelectedIndex();        
            
            switch (index){
                case 0:                     
                    billDateBox.setText(row[0]);
                    if(row[1].equals("Rent")  || row[1].equals("Fee"))
                    {
                       billTypeDropBox.setSelectedItem(row[1]);
                    }
                    else
                    {
                         billTypeDropBox.setSelectedIndex(2);
                    }
                    billPaymentDateBox.setText(row[4]);
                    billAmountBox.setText(row[2]);
                    billSSNBox.setText(row[3]);
                    break;
                case 1:       
                    //query = "SELECT * FROM EMERGENCY_CONTACT";        
                    //table.setModel(getTableFromQuery(query)); 
                    emergencyContactFirstNameBox.setText(row[0]);
                    emergencyContactLastNameBox.setText(row[1]);
                    emergencyContactPhoneNumberBox.setText(row[2]);
                    emergencyContactTenantSSNBox.setText(row[3]);
                    informationPane.moveToFront(emergencyContactPanel);
                    break;
                case 2:
                    //query = "SELECT * FROM EMPLOYEE";        
                    //table.setModel(getTableFromQuery(query));
                    employeeSSNBox.setText(row[0]);
                    employeeFirstNameBox.setText(row[1]);
                    employeeLastNameBox.setText(row[2]);
                    employeePositionBox.setText(row[3]);
                    employeePhoneNumberBox.setText(row[4]);
                    employeeAddressBox.setText(row[5]);
                    employeeCityBox.setText(row[6]);
                    employeeStateBox.setText(row[7]);
                    employeeZipBox.setText(row[8]);
                    informationPane.moveToFront(employeePanel);
                    break;
                case 3:
                     if(row[0].equals("Promo"))
                    {
                        leaseTypeDropBox.setSelectedIndex(0);
                    }
                     else
                     {
                        leaseTypeDropBox.setSelectedIndex(1);
                     }
                     leaseSSNBox.setText(row[2]);
                     leaseStartDateBox.setText(row[1]);
                     DateFormat formatter ; 
                    Date date ; 
                    formatter = new SimpleDateFormat("yyyy-MM-dd");
                    date = (Date)formatter.parse(row[1].substring(0,10)); 
                    Calendar cal=Calendar.getInstance();
                    cal.setTime(date);
                     //Calendar date = new Calendar(row[1]);
                     leaseStartDateBox.setSelectedDate(cal);
                    break;
                case 4:
                     if(row[0].equals("Checking"))
                    {
                        leaseTypeDropBox.setSelectedIndex(0);
                    }
                     else
                     {
                        leaseTypeDropBox.setSelectedIndex(1);
                     }
                     paySSNBox.setText(row[3]);
                     payRoutingNumBox.setText(row[1]);
                     payAcctNumBox.setText(row[2]);
                    
                    break;
                case 5:                 
                    tenantSSNBox.setText(row[0]);
                    tenantFirstNameBox.setText(row[1]);
                    tenantLastNameBox.setText(row[2]);
                    tenantPhoneNumberBox.setText(row[3]);
                    tenantEmailBox.setText(row[4]);
                    tenantAptNumberBox.setText(row[5]);
                    break;
                case 6:                   
                    utilitiesTypeBox.setSelectedItem(row[0]);
                    utilitiesProviderBox.setText(row[1]);
                    utilitiesCostBox.setText(row[2]);
                    break;
                case 7:
                   // query = "SELECT * FROM VEHICLE";        
                    //table.setModel(getTableFromQuery(query));
                    vehicleStateBox.setText(row[0]);
                    vehicleLicensePlateBox.setText(row[1]);
                    vehicleOwnerSSNBox.setText(row[5]);
                    vehicleYearBox.setText(row[2]);
                    vehicleMakeBox.setText(row[3]);
                    vehicleModelBox.setText(row[4]);
                    informationPane.moveToFront(vehiclePanel);
                    break;                
                case 8:
                    writeUpSSNBox.setText(row[3]);
                    writeUpDateBox.setText(row[0]);
                    writeUpDescriptionBox.setText(row[2]);
                    if(row[1].equals("Complaint") || row[1].equals("General") || row[1].equals("Accident"))
                    {
                        writeUpTypeDropBox.setSelectedItem(row[1]);
                    }
                    else
                    {
                        writeUpTypeDropBox.setSelectedIndex(3);
                    }
                    
                    break;
            }
    }
   private void showAllFromDropBox()
   {
      SwingWorker bgThread = new SwingWorker() {
        String query;
           @Override
           protected Object doInBackground() throws Exception {
               
                try {
            int index = selectionBox.getSelectedIndex();        
            
            switch (index){
                case 0:
                    query = "SELECT * FROM BILL";        
                    table.setModel(getTableFromQuery(query));   
                    informationPane.moveToFront(billPanel);                
                    break;
                case 1:       
                    query = "SELECT * FROM EMERGENCY_CONTACT";        
                    table.setModel(getTableFromQuery(query));   
                    informationPane.moveToFront(emergencyContactPanel);
                    break;
                case 2:
                    query = "SELECT * FROM EMPLOYEE";        
                    table.setModel(getTableFromQuery(query));    
                    informationPane.moveToFront(employeePanel);
                    break;
                case 3:
                    query = "SELECT * FROM LEASE";        
                    table.setModel(getTableFromQuery(query));    
                    informationPane.moveToFront(leasePanel);
                    break;
                case 4:
                    query = "SELECT * FROM PAYMENTTYPE";        
                    table.setModel(getTableFromQuery(query));    
                    informationPane.moveToFront(paymentInfoPanel);
                    break;
                case 5:
                    query = "SELECT * FROM TENANT";        
                    table.setModel(getTableFromQuery(query));    
                    informationPane.moveToFront(tenantPanel);
                    break;
                case 6:
                    query = "SELECT * FROM UTILITIES";        
                    table.setModel(getTableFromQuery(query));    
                    informationPane.moveToFront(utilitiesPanel);
                    break;
                case 7:
                    query = "SELECT * FROM VEHICLE";        
                    table.setModel(getTableFromQuery(query));   
                    informationPane.moveToFront(vehiclePanel);
                    break;               
                case 8:
                    query = "SELECT * FROM WRITEUPS";        
                    table.setModel(getTableFromQuery(query));   
                    informationPane.moveToFront(writeUpPanel);
                    break;
            }
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }
               
               throw new UnsupportedOperationException("Not supported yet.");
           }
       };
       bgThread.execute();
       
   }
    private void selectionBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_selectionBoxItemStateChanged
        showAllFromDropBox();
    }//GEN-LAST:event_selectionBoxItemStateChanged

    private void tenantAddButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tenantAddButtonMouseClicked
        try {   
            ////////////////////////////////////////////////
            String SSN = tenantSSNBox.getText();
            String fname = tenantFirstNameBox.getText();
            String lname = tenantLastNameBox.getText();
            String phone = tenantPhoneNumberBox.getText();
            String email = tenantEmailBox.getText();
            String aptNumber = tenantAptNumberBox.getText();
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!SSN.isEmpty() && !fname.isEmpty() && !lname.isEmpty() && !aptNumber.isEmpty())
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = null;
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                
                query = "INSERT INTO SSNS VALUES(?)";
                statement = conn.prepareStatement(query);
                statement.setString(1, SSN);
                statement.executeUpdate();
                
                query = "INSERT INTO TENANT VALUES (?,?,?,?,?,?)";
                
                statement = conn.prepareStatement(query);
                /////////////////////////////////
                statement.setString(1, SSN);
                statement.setString(2, fname);
                statement.setString(3, lname);
                statement.setString(4, phone);
                statement.setString(5, email);
                statement.setString(6, aptNumber);
                
                /////////////////////////////////
                statement.executeUpdate(); 
                
                statement.close();
            
                /////////////////////////////////
                query = "SELECT * FROM TENANT";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
             else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_tenantAddButtonMouseClicked

    private void tenantUpdateButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tenantUpdateButtonMouseClicked
           try {  
            //////////////////////////////////////////////////
            String SSN = tenantSSNBox.getText();
            String fname = tenantFirstNameBox.getText();
            String lname = tenantLastNameBox.getText();
            String phone = tenantPhoneNumberBox.getText();
            String email = tenantEmailBox.getText();
            String aptNumber = tenantAptNumberBox.getText();
            ///////////////////////////////////////////////////
            
            //if required fields are not empty
            //////////////////////////////////////////////////////////////////////////////////
            if(!SSN.isEmpty() && !fname.isEmpty() && !lname.isEmpty() && !aptNumber.isEmpty())
            //////////////////////////////////////////////////////////////////////////////////
            {
                System.out.println(SSN);
                //be careful there is no comma before where
                String query = "UPDATE TENANT SET SSN = ?, FNAME = ?, LNAME = ?, PHONENUM = ?, EMAIL = ?, APTNO = ? WHERE SSN = ?";
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                ///////////////////////////////
                statement.setString(1, SSN);
                statement.setString(2, fname);
                statement.setString(3, lname);
                statement.setString(4, phone);
                statement.setString(5, email);
                statement.setString(6, aptNumber);
                statement.setString(7, SSN);
                ///////////////////////////////
                statement.executeUpdate();
                statement.close();
           
                /////////////////////////////////////////change to primary key in table
                query = "SELECT * FROM TENANT WHERE SSN = ?";// WHERE SSN = " + SSN; 
                //////////////////////////////////////////
                statement = conn.prepareStatement(query);     
                /////////////////////////////change to primary key in table
                statement.setString(1, SSN);
                /////////////////////////////
                ResultSet rset = statement.executeQuery();
                ListTableModel model = ListTableModel.createModelFromResultSet( rset );
                table.setModel(model);
            }
                else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_tenantUpdateButtonMouseClicked

    private void tenantDeleteButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tenantDeleteButtonMouseClicked
         //just need primary key 
        /////////////////////////////////////
        String SSN = tenantSSNBox.getText();
        System.out.println(SSN);
        /////////////////////////////////////
        String query;
        if(!SSN.isEmpty())
        {
            int choice = JOptionPane.showConfirmDialog(this, "Do you really want to delete this record?"
                    ,"", JOptionPane.YES_NO_OPTION,
                    JOptionPane.WARNING_MESSAGE
                    );
             //user chose yes         
            if(choice == 0)
            {                   
                try {
                    /////////////////////////////////////////////
                    query = "DELETE FROM TENANT WHERE SSN = ?";
                    //query = "DELETE FROM SSNS WHERE SSN = ?";
                    //////////////////////////////////////////////
                    DBconnection db = new DBconnection();
                    Connection conn = db.getConnection();
                    PreparedStatement statement = null;
                    statement = conn.prepareStatement(query);
                    ///////////////////////////////
                    statement.setString(1, SSN);
                    //////////////////////////////
                    statement.executeUpdate();
                    statement.close();
                    /////////////////////////////////
                    query = "SELECT * FROM TENANT";
                    /////////////////////////////////
                    statement = conn.prepareStatement(query);                   
                    ResultSet rset = statement.executeQuery();
                    
                    ListTableModel model = ListTableModel.createModelFromResultSet( rset );
                    table.setModel(model);
                    
                } catch (SQLException ex) {
                    Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        else
        {
            JOptionPane.showMessageDialog(this, "Must enter SSN");
        }
    }//GEN-LAST:event_tenantDeleteButtonMouseClicked

    private void utilitiesAddMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_utilitiesAddMouseClicked
 try {   
            ////////////////////////////////////////////////
            String type = utilitiesTypeBox.getSelectedItem().toString();
            String provider = utilitiesProviderBox.getText();
            String cost = utilitiesCostBox.getText();
           
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!type.isEmpty() && !provider.isEmpty() && !cost.isEmpty() )
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = "INSERT INTO UTILITIES VALUES (?,?,?)";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////
                statement.setString(1, type);
                statement.setString(2, provider);
                statement.setString(3, cost);
                
                /////////////////////////////////
                statement.executeUpdate(); 
                statement.close();
            
                /////////////////////////////////
                query = "SELECT * FROM UTILITIES";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }
                                        // TODO add your handling code here:
    }//GEN-LAST:event_utilitiesAddMouseClicked

    private void utilitiesUpdateMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_utilitiesUpdateMouseClicked
  try {  
            //////////////////////////////////////////////////
            String type = utilitiesTypeBox.getSelectedItem().toString();
            String provider = utilitiesProviderBox.getText();
            String cost = utilitiesCostBox.getText();
            ///////////////////////////////////////////////////
            
            //if required fields are not empty
            //////////////////////////////////////////////////////////////////////////////////
            if(!type.isEmpty() && !provider.isEmpty() && !cost.isEmpty() )
            //////////////////////////////////////////////////////////////////////////////////
            {
                System.out.println(type);
                //be careful there is no comma before where
                String query = "UPDATE UTILITIES SET KIND = ?, provider = ?, cost = ? WHERE KIND = ?";
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                ///////////////////////////////
                statement.setString(1, type);
                statement.setString(2, provider);
                statement.setString(3, cost);
                statement.setString(4, type);
                
                ///////////////////////////////
                statement.executeUpdate();
                statement.close();
           
                /////////////////////////////////////////change to primary key in table
                query = "SELECT * FROM UTILITIES";// WHERE SSN = " + SSN; 
                //////////////////////////////////////////
                statement = conn.prepareStatement(query);     
                /////////////////////////////change to primary key in table
                statement.setString(1, type);
                /////////////////////////////
                ResultSet rset = statement.executeQuery();
                ListTableModel model = ListTableModel.createModelFromResultSet( rset );
                table.setModel(model);
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }

                                                 
        // TODO add your handling code here:
    }//GEN-LAST:event_utilitiesUpdateMouseClicked

    private void tenantUpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tenantUpdateButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tenantUpdateButtonActionPerformed

    private void utilitiesDeleteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_utilitiesDeleteMouseClicked
     //just need primary key 
        /////////////////////////////////////
        String type = utilitiesTypeBox.getSelectedItem().toString();
        /////////////////////////////////////
        String query;
        if(!type.isEmpty())
        {
            int choice = JOptionPane.showConfirmDialog(this, "Do you really want to delete this record?"
                    ,"", JOptionPane.YES_NO_OPTION,
                    JOptionPane.WARNING_MESSAGE
                    );
             //user chose yes         
            if(choice == 0)
            {                   
                try {
                    /////////////////////////////////////////////
                    query = "DELETE FROM UTILITIES WHERE KIND = ?";
                    //////////////////////////////////////////////
                    DBconnection db = new DBconnection();
                    Connection conn = db.getConnection();
                    PreparedStatement statement = null;
                    statement = conn.prepareStatement(query);
                    ///////////////////////////////
                    statement.setString(1, type);
                    //////////////////////////////
                    statement.executeUpdate();
                    statement.close();
                    /////////////////////////////////
                    query = "SELECT * FROM UTILITIES";
                    /////////////////////////////////
                    statement = conn.prepareStatement(query);                   
                    ResultSet rset = statement.executeQuery();
                    
                    ListTableModel model = ListTableModel.createModelFromResultSet( rset );
                    table.setModel(model);
                    
                } catch (SQLException ex) {
                    Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        else
        {
            JOptionPane.showMessageDialog(this, "Must enter type");
        }
                                                   
        // TODO add your handling code here:
    }//GEN-LAST:event_utilitiesDeleteMouseClicked

    private void showAllButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_showAllButtonMouseClicked
        showAllFromDropBox();                // TODO add your handling code here:
    }//GEN-LAST:event_showAllButtonMouseClicked

    private void checkSSNLength(String SSN)
    {
         if(SSN.length() != 11)
            {
                String st="Invalid SSN";
                JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
            }
            //
    }
    private void tableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableMouseClicked
        if(table.getSelectedRow() != -1)
        {
            try {
                String[] row = stringFromRow();
                fillBoxes(row);
            } catch (ParseException ex) {
                Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_tableMouseClicked

    private void writeUpAddButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_writeUpAddButtonMouseClicked
            try {   
            ////////////////////////////////////////////////
            String date = writeUpDateBox.getText();
            String ssn = writeUpSSNBox.getText();
            String description = writeUpDescriptionBox.getText();
            String offense = writeUpTypeDropBox.getSelectedItem().toString();
            
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!ssn.isEmpty() && !date.isEmpty() && !offense.isEmpty() && !description.isEmpty())
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = "INSERT INTO WRITEUPS VALUES (?,?,?,?)";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////
                statement.setString(1, date);
                statement.setString(2, offense);
                statement.setString(3, description);
                statement.setString(4, ssn);
               

                /////////////////////////////////
                statement.executeUpdate(); 
                statement.close();
            
                /////////////////////////////////
                query = "SELECT * FROM WRITEUPS";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        } // TODO add your handling code here:
    }//GEN-LAST:event_writeUpAddButtonMouseClicked

    private void employeeAddButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_employeeAddButtonMouseClicked
        try {   
            ////////////////////////////////////////////////
            String SSN = employeeSSNBox.getText();
            String fname = employeeFirstNameBox.getText();
            String lname = employeeLastNameBox.getText();
            String phone = employeePhoneNumberBox.getText();
            String position = employeePositionBox.getText();
            String address = employeeAddressBox.getText();
            String city = employeeCityBox.getText();
            String state = employeeStateBox.getText();
            String zip = employeeZipBox.getText();
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!SSN.isEmpty() && !fname.isEmpty() && !lname.isEmpty() && !position.isEmpty())
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = null;
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
               
                
                query = "INSERT INTO SSNS VALUES(?)";
                statement = conn.prepareStatement(query);
                statement.setString(1, SSN);
                statement.executeUpdate();
                
                query = "INSERT INTO EMPLOYEE VALUES (?,?,?,?,?,?,?,?,?)"; 
                
                statement = conn.prepareStatement(query);
                /////////////////////////////////
                statement.setString(1, SSN);
                statement.setString(2, fname);
                statement.setString(3, lname);
                statement.setString(4, position);
                statement.setString(5, phone);
                statement.setString(6, address);
                statement.setString(7, city);
                statement.setString(8, state);
                statement.setString(9, zip);

                /////////////////////////////////
                statement.executeUpdate(); 
                statement.close();
            
                /////////////////////////////////
                query = "SELECT * FROM EMPLOYEE";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_employeeAddButtonMouseClicked

    private void employeeUpdateButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_employeeUpdateButtonMouseClicked
                try {   
            ////////////////////////////////////////////////
                    String[] row = stringFromRow();
            String SSN = employeeSSNBox.getText();
            String fname = employeeFirstNameBox.getText();
            String lname = employeeLastNameBox.getText();
            String phone = employeePhoneNumberBox.getText();
            String position = employeePositionBox.getText();
            String address = employeeAddressBox.getText();
            String city = employeeCityBox.getText();
            String state = employeeStateBox.getText();
            String zip = employeeZipBox.getText();
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!SSN.isEmpty() && !fname.isEmpty() && !lname.isEmpty() && !position.isEmpty())
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = "UPDATE EMPLOYEE SET SSN = ? , FNAME = ? , LNAME = ? ,"
                        + "POSITION = ? , PHONE = ? , ADDRESS = ? , CITY = ? , ST = ?, ZIP = ? "
                        + "WHERE SSN = ? ";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////
                statement.setString(1, SSN);
                statement.setString(2, fname);
                statement.setString(3, lname);
                statement.setString(4, position);
                statement.setString(5, phone);
                statement.setString(6, address);
                statement.setString(7, city);
                statement.setString(8, state);
                statement.setString(9, zip);
                statement.setString(10, row[0]);

                /////////////////////////////////
                statement.executeUpdate(); 
                statement.close();
            
                /////////////////////////////////
                query = "SELECT * FROM EMPLOYEE";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_employeeUpdateButtonMouseClicked

    private void employeeDeleteButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_employeeDeleteButtonMouseClicked
           
        //just need primary key 
        /////////////////////////////////////
        String ssn = employeeSSNBox.getText();
        /////////////////////////////////////
        String query;
        if(!ssn.isEmpty())
        {
            int choice = JOptionPane.showConfirmDialog(this, "Do you really want to delete this record?"
                    ,"", JOptionPane.YES_NO_OPTION,
                    JOptionPane.WARNING_MESSAGE
                    );
             //user chose yes         
            if(choice == 0)
            {                   
                try {
                    /////////////////////////////////////////////
                    query = "DELETE FROM EMPLOYEE WHERE SSN = ?";
                    //////////////////////////////////////////////
                    DBconnection db = new DBconnection();
                    Connection conn = db.getConnection();
                    PreparedStatement statement = null;
                    statement = conn.prepareStatement(query);
                    ///////////////////////////////
                    statement.setString(1, ssn);
                    //////////////////////////////
                    statement.executeUpdate();
                    statement.close();
                    /////////////////////////////////
                    query = "SELECT * FROM EMPLOYEE";
                    /////////////////////////////////
                    statement = conn.prepareStatement(query);                   
                    ResultSet rset = statement.executeQuery();
                    
                    ListTableModel model = ListTableModel.createModelFromResultSet( rset );
                    table.setModel(model);
                    
                } catch (SQLException ex) {
                    Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        else
        {
            JOptionPane.showMessageDialog(this, "Must enter SSN");
        }
                                                 
    }//GEN-LAST:event_employeeDeleteButtonMouseClicked

    private void emergAddButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_emergAddButtonMouseClicked
           try {   
            ////////////////////////////////////////////////
            String SSN = emergencyContactTenantSSNBox.getText();
            String fname = emergencyContactFirstNameBox.getText();
            String lname = emergencyContactLastNameBox.getText();
            String phone = emergencyContactPhoneNumberBox.getText();
          
            checkSSNLength(SSN);
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!SSN.isEmpty() && !fname.isEmpty() && !lname.isEmpty())
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = "INSERT INTO EMERGENCY_CONTACT VALUES (?,?,?,?)";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////
                statement.setString(4, SSN);
                statement.setString(1, fname);
                statement.setString(2, lname);                
                statement.setString(3, phone);
                
                /////////////////////////////////
                statement.executeUpdate(); 
                statement.close();
            
                /////////////////////////////////
                query = "SELECT * FROM EMERGENCY_CONTACT";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
            
        }
    }//GEN-LAST:event_emergAddButtonMouseClicked

    private void emergUpdatebuttonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_emergUpdatebuttonMouseClicked
        String[] row = stringFromRow();     
        try {   
            ////////////////////////////////////////////////
            String SSN = emergencyContactTenantSSNBox.getText();
            String fname = emergencyContactFirstNameBox.getText();
            String lname = emergencyContactLastNameBox.getText();
            String phone = emergencyContactPhoneNumberBox.getText();
            
            checkSSNLength(SSN);
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!SSN.isEmpty() && !fname.isEmpty() && !lname.isEmpty())
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = "UPDATE EMERGENCY_CONTACT SET TSSN = ? , FNAME = ? , LNAME = ? ,"
                        + "PHONE = ?  "
                        + "WHERE TSSN = ? AND FNAME = ? AND LNAME = ?";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////
                statement.setString(4, SSN);
                statement.setString(1, fname);
                statement.setString(2, lname);
                statement.setString(3, phone);
                statement.setString(5, row[3]);
                statement.setString(6, row[0]);
                statement.setString(7, row[1]);                
               

                /////////////////////////////////
                statement.executeUpdate(); 
                statement.close();
            
                /////////////////////////////////
                query = "SELECT * FROM EMERGENCY_CONTACT";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
             else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }      // TODO add your handling code here:
    }//GEN-LAST:event_emergUpdatebuttonMouseClicked

    private void emergDeleteButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_emergDeleteButtonMouseClicked
        //just need primary key 
        /////////////////////////////////////
        String ssn = emergencyContactTenantSSNBox.getText();
        String fname = emergencyContactFirstNameBox.getText();
        String lname = emergencyContactLastNameBox.getText();
        /////////////////////////////////////
        String query;
        if(!ssn.isEmpty())
        {
            int choice = JOptionPane.showConfirmDialog(this, "Do you really want to delete this record?"
                    ,"", JOptionPane.YES_NO_OPTION,
                    JOptionPane.WARNING_MESSAGE
                    );
             //user chose yes         
            if(choice == 0)
            {                   
                try {
                    /////////////////////////////////////////////
                    query = "DELETE FROM EMERGENCY_CONTACT WHERE TSSN = ? AND FNAME = ? AND LNAME = ? ";
                    //////////////////////////////////////////////
                    DBconnection db = new DBconnection();
                    Connection conn = db.getConnection();
                    PreparedStatement statement = null;
                    statement = conn.prepareStatement(query);
                    ///////////////////////////////
                    statement.setString(1, ssn);
                    statement.setString(2, fname);
                    statement.setString(3, lname);
                    //////////////////////////////
                    statement.executeUpdate();
                    statement.close();
                    /////////////////////////////////
                    query = "SELECT * FROM EMERGENCY_CONTACT";
                    /////////////////////////////////
                    statement = conn.prepareStatement(query);                   
                    ResultSet rset = statement.executeQuery();
                    
                    ListTableModel model = ListTableModel.createModelFromResultSet( rset );
                    table.setModel(model);
                    
                } catch (SQLException ex) {
                    Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        else
        {
            JOptionPane.showMessageDialog(this, "Must enter Tenant SSN");
        }        // TODO add your handling code here:
    }//GEN-LAST:event_emergDeleteButtonMouseClicked

    private void writeUpUpdateButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_writeUpUpdateButtonMouseClicked
        String[] row = stringFromRow();     
        try {   
            ////////////////////////////////////////////////
        String date = writeUpDateBox.getText();
            String ssn = writeUpSSNBox.getText();
            String description = writeUpDescriptionBox.getText();
            String offense = writeUpTypeDropBox.getSelectedItem().toString();
            
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!ssn.isEmpty() && !date.isEmpty() && !offense.isEmpty() && !description.isEmpty())
            {
                ///////////////////////////////////////////////////////////
                String query = "UPDATE WRITEUPS SET INCIDENTDATE = ? , OFFENSE = ?, DESCRIPTION = ? , ESSN = ? "                      
                        + "WHERE INCIDENTDATE = ? AND OFFENSE = ? AND ESSN = ? ";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////
              
                statement.setString(1, date);
                statement.setString(2, offense);
                statement.setString(3, description);
                statement.setString(4, ssn);                
                statement.setString(5, row[0]);
                statement.setString(6, row[1]);
                statement.setString(7, row[3]);               

                /////////////////////////////////
                statement.executeUpdate(); 
                statement.close();
            
                /////////////////////////////////
                query = "SELECT * FROM WRITEUPS";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        } 
    }//GEN-LAST:event_writeUpUpdateButtonMouseClicked

    private void writeUpDeleteButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_writeUpDeleteButtonMouseClicked
        //just need primary key 
      String date = writeUpDateBox.getText();
            String ssn = writeUpSSNBox.getText();
            String description = writeUpDescriptionBox.getText();
            String offense = writeUpTypeDropBox.getSelectedItem().toString();;
        /////////////////////////////////////
        String query;
        if(!ssn.isEmpty() && !date.isEmpty() && !offense.isEmpty() && !description.isEmpty())
        {
            int choice = JOptionPane.showConfirmDialog(this, "Do you really want to delete this record?"
                    ,"", JOptionPane.YES_NO_OPTION,
                    JOptionPane.WARNING_MESSAGE
                    );
             //user chose yes         
            if(choice == 0)
            {                   
                try {
                    /////////////////////////////////////////////
                    query = "DELETE FROM WRITEUPS WHERE INCIDENTDATE = ? AND OFFENSE = ? AND DESCRIPTION = ? AND ESSN = ? ";
                    //////////////////////////////////////////////
                    DBconnection db = new DBconnection();
                    Connection conn = db.getConnection();
                    PreparedStatement statement = null;
                    statement = conn.prepareStatement(query);
                    ///////////////////////////////
                    statement.setString(1, date);
                statement.setString(2, offense);
                statement.setString(3, description);
                statement.setString(4, ssn);
                    //////////////////////////////
                    statement.executeUpdate();
                    statement.close();
                    /////////////////////////////////
                    query = "SELECT * FROM WRITEUPS";
                    /////////////////////////////////
                    statement = conn.prepareStatement(query);                   
                    ResultSet rset = statement.executeQuery();
                    
                    ListTableModel model = ListTableModel.createModelFromResultSet( rset );
                    table.setModel(model);
                    
                } catch (SQLException ex) {
                    Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        else
        {
            JOptionPane.showMessageDialog(this, "Must enter Tenant SSN");
        }        // TODO add your handling code here:
    }//GEN-LAST:event_writeUpDeleteButtonMouseClicked

    private void billDeleteButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_billDeleteButtonMouseClicked
        //just need primary key
        /////////////////////////////////////
        String initialDate = billDateBox.getText();
        String amount = billAmountBox.getText();
        String ssn = billSSNBox.getText();
        String paymentDate = billPaymentDateBox.getText();
        String type = billTypeDropBox.getSelectedItem().toString();
        /////////////////////////////////////
        String query;
        if(!ssn.isEmpty() && !amount.isEmpty() && !initialDate.isEmpty())
        {
            int choice = JOptionPane.showConfirmDialog(this, "Do you really want to delete this record?"
                ,"", JOptionPane.YES_NO_OPTION,
                JOptionPane.WARNING_MESSAGE
            );
            //user chose yes
            if(choice == 0)
            {
                try {
                    /////////////////////////////////////////////
                    query = "DELETE FROM BILL WHERE BILLDATE = ? AND DESCRIPTION = ? AND AMOUNT = ? AND TSSN = ? ";
                    //////////////////////////////////////////////
                    DBconnection db = new DBconnection();
                    Connection conn = db.getConnection();
                    PreparedStatement statement = null;
                    statement = conn.prepareStatement(query);
                    ///////////////////////////////
                    statement.setString(1, initialDate);
                    statement.setString(2, type);
                    statement.setString(3, amount);
                    statement.setString(4, ssn);
                    //////////////////////////////
                    statement.executeUpdate();
                    statement.close();
                    /////////////////////////////////
                    query = "SELECT * FROM BILL";
                    /////////////////////////////////
                    statement = conn.prepareStatement(query);
                    ResultSet rset = statement.executeQuery();

                    ListTableModel model = ListTableModel.createModelFromResultSet( rset );
                    table.setModel(model);

                } catch (SQLException ex) {
                    Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        else
        {
            JOptionPane.showMessageDialog(this, "Must enter Tenant SSN");
        }         // TODO add your handling code here:
    }//GEN-LAST:event_billDeleteButtonMouseClicked

    private void billUpdateButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_billUpdateButtonMouseClicked
        String[] row = stringFromRow();
        try {
            ////////////////////////////////////////////////
            String initialDate = billDateBox.getText();
            String amount = billAmountBox.getText();
            String ssn = billSSNBox.getText();
            String paymentDate = billPaymentDateBox.getText();
            String type = billTypeDropBox.getSelectedItem().toString();

            //checkSSNLength(SSN);
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!ssn.isEmpty() && !amount.isEmpty() && !initialDate.isEmpty())
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = "UPDATE BILL SET BILLDATE = ? , DESCRIPTION = ? , AMOUNT = ? ,"
                + "TSSN = ?, PAYDATE = ?  "
                + "WHERE BILLDATE = ? AND AMOUNT = ? AND DESCRIPTION = ? AND TSSN = ? ";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////
                if(paymentDate.startsWith("null") || paymentDate.startsWith(" "))
                {
                    paymentDate = null;
                }
                statement.setString(1, initialDate);
                statement.setString(2, type);
                statement.setString(3, amount);
                statement.setString(4, ssn);
                statement.setString(5, paymentDate);
                statement.setString(6, row[0]);
                statement.setString(7, row[2]);
                statement.setString(8, row[1]);
                statement.setString(9, row[3]);

                /////////////////////////////////
                statement.executeUpdate();
                statement.close();

                /////////////////////////////////
                query = "SELECT * FROM BILL";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }

        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_billUpdateButtonMouseClicked

    private void billAddButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_billAddButtonMouseClicked
        try {
            ////////////////////////////////////////////////
            String initialDate = billDateBox.getText();
            String amount = billAmountBox.getText();
            String ssn = billSSNBox.getText();
            String paymentDate = billPaymentDateBox.getText();
            String type = billTypeDropBox.getSelectedItem().toString();

            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!ssn.isEmpty() && !initialDate.isEmpty() && !amount.isEmpty() && !type.contains(ssn))
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = "INSERT INTO BILL VALUES (?,?,?,?,?)";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////

                statement.setString(1, initialDate);
                statement.setString(2, type);
                statement.setString(3, amount);
                statement.setString(4, ssn);
                statement.setString(5, null);

                /////////////////////////////////
                statement.executeUpdate();
                statement.close();

                /////////////////////////////////
                query = "SELECT * FROM BILL";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }

        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);

        }       // TODO add your handling code here:
    }//GEN-LAST:event_billAddButtonMouseClicked

    private void tenantSearchButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tenantSearchButtonMouseClicked
        try {
            int index = tenantSearchDropBox.getSelectedIndex();
            String query = null;
            String searchTerm =  tenantSearchBox.getText();
            
            switch (index){
                  case 0:                     
                      query = "SELECT * FROM TENANT WHERE APTNO = "+ searchTerm;
                      break;
                  case 1:       
                      query = "SELECT * FROM TENANT WHERE LNAME = '"+ searchTerm+"'";
                      break;
                  case 2:
                     query = "SELECT * FROM TENANT WHERE SSN = '"+searchTerm+"'";
                      break;
                  default:                    
                      break;
              }
            //statement.setString(1, initialDate);
            //System.out.println(query);
           table.setModel(getTableFromQuery(query));
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_tenantSearchButtonMouseClicked

    private void employeeSearchButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_employeeSearchButtonMouseClicked
        try {
            int index = employeeSearchDropBox.getSelectedIndex();
            
            String query = null;
                String searchTerm =  employeeSearchBox.getText();
                
                switch (index){                  
                      case 0:       
                          query = "SELECT * FROM EMPLOYEE WHERE LNAME = '"+ searchTerm+"'";
                          break;
                      case 1:
                         query = "SELECT * FROM EMPLOYEE WHERE SSN = '"+searchTerm+"'";
                          break;
                      default:                    
                          break;
                  }
                
                table.setModel(getTableFromQuery(query));
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_employeeSearchButtonMouseClicked

    private void writeUpSearchButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_writeUpSearchButtonMouseClicked
        try {
            String ssn = writeUpSSNSearchBox.getText(); 
            String query = "SELECT * FROM WRITEUPS WHERE ESSN = '"+ ssn+"'";
            table.setModel(getTableFromQuery(query));
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }//GEN-LAST:event_writeUpSearchButtonMouseClicked

    private void billSearchButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_billSearchButtonMouseClicked
        try {
            String ssn = billSSNSearchBox.getText();
            String query = "SELECT * FROM BILL WHERE TSSN = '"+ ssn+"'";
        table.setModel(getTableFromQuery(query));
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_billSearchButtonMouseClicked

    private void emergencyContactSearchButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_emergencyContactSearchButtonMouseClicked
        try {
            String ssn = emergencyContactSearchBox.getText();       
            String query = "SELECT * FROM EMERGENCY_CONTACT WHERE TSSN = '"+ ssn+"'";
            table.setModel(getTableFromQuery(query));
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_emergencyContactSearchButtonMouseClicked

    private void vehicleAddButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_vehicleAddButtonMouseClicked
                try {
            ////////////////////////////////////////////////
            String state = vehicleStateBox.getText();
            String plate = vehicleLicensePlateBox.getText();
            String ssn = vehicleOwnerSSNBox.getText();
            String make = vehicleMakeBox.getText();
            String model = vehicleModelBox.getText();
            String year = vehicleYearBox.getText();

            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!ssn.isEmpty() && !plate.isEmpty() && !ssn.isEmpty() )
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = "INSERT INTO VEHICLE VALUES (?,?,?,?,?,?)";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////

                statement.setString(1, state);
                statement.setString(2, plate);
                statement.setString(3, year);
                statement.setString(4, make);
                statement.setString(5, model);
                statement.setString(6, ssn);

                /////////////////////////////////
                statement.executeUpdate();
                statement.close();

                /////////////////////////////////
                query = "SELECT * FROM VEHICLE";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }

        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);

        }   // TODO add your handling code here:
    }//GEN-LAST:event_vehicleAddButtonMouseClicked

    private void vehicleUpdateButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_vehicleUpdateButtonMouseClicked
        String[] row = stringFromRow();     
        try {   
            ////////////////////////////////////////////////
        String state = vehicleStateBox.getText();
            String plate = vehicleLicensePlateBox.getText();
            String ssn = vehicleOwnerSSNBox.getText();
            String make = vehicleMakeBox.getText();
            String model = vehicleModelBox.getText();
            String year = vehicleYearBox.getText();
            
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!ssn.isEmpty() && !state.isEmpty() && !plate.isEmpty())
            {
                ///////////////////////////////////////////////////////////
                String query = "UPDATE VEHICLE SET ST = ? , PLATENUM = ? , YR = ? , MAKE = ? , MODEL = ? , SSN = ? "                      
                        + "WHERE  ST = ? AND PLATENUM = ? AND SSN = ? ";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////
              
                statement.setString(1, state);
                statement.setString(2, plate);
                statement.setString(3, year);
                statement.setString(4, make);                
                statement.setString(5, model);
                statement.setString(6, ssn);
                statement.setString(7, row[0]);  
                statement.setString(8, row[1]); 
                statement.setString(9, row[5]);  

                /////////////////////////////////
                statement.executeUpdate(); 
                statement.close();
            
                /////////////////////////////////
                query = "SELECT * FROM VEHICLE";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }         // TODO add your handling code here:
    }//GEN-LAST:event_vehicleUpdateButtonMouseClicked

    private void vehicleDeleteButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_vehicleDeleteButtonMouseClicked
            String state = vehicleStateBox.getText();
            String plate = vehicleLicensePlateBox.getText();
        /////////////////////////////////////
        String query;
        if(!state.isEmpty() && !plate.isEmpty())
        {
            int choice = JOptionPane.showConfirmDialog(this, "Do you really want to delete this record?"
                ,"", JOptionPane.YES_NO_OPTION,
                JOptionPane.WARNING_MESSAGE
            );
            //user chose yes
            if(choice == 0)
            {
                try {
                    /////////////////////////////////////////////
                    query = "DELETE FROM VEHICLE WHERE ST = ? AND PLATENUM = ?  ";
                    //////////////////////////////////////////////
                    DBconnection db = new DBconnection();
                    Connection conn = db.getConnection();
                    PreparedStatement statement = null;
                    statement = conn.prepareStatement(query);
                    ///////////////////////////////
                    statement.setString(1, state);
                    statement.setString(2, plate);
                    
                    //////////////////////////////
                    statement.executeUpdate();
                    statement.close();
                    /////////////////////////////////
                    query = "SELECT * FROM VEHICLE";
                    /////////////////////////////////
                    statement = conn.prepareStatement(query);
                    ResultSet rset = statement.executeQuery();

                    ListTableModel model = ListTableModel.createModelFromResultSet( rset );
                    table.setModel(model);

                } catch (SQLException ex) {
                    Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        else
        {
            JOptionPane.showMessageDialog(this, "Must enter State and Plate Number");
        }    // TODO add your handling code here:
    }//GEN-LAST:event_vehicleDeleteButtonMouseClicked

    private void vehicleSearchButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_vehicleSearchButtonMouseClicked
                try {
            String state = vehicleStateBox.getText();
            String plate = vehicleLicensePlateBox.getText();
            String query = "SELECT * FROM VEHICLE WHERE ST = '"+ state+"' AND PLATENUM = '"+plate+"'";
        table.setModel(getTableFromQuery(query));
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }// TODO add your handling code here:
    }//GEN-LAST:event_vehicleSearchButtonMouseClicked

    private void paySearchButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_paySearchButtonMouseClicked
         try {
            String ssn = paySearchBox.getText();
           
            String query = "SELECT * FROM PAYMENTTYPE WHERE TSSN = '"+ ssn+"'";
        table.setModel(getTableFromQuery(query));
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        } // TODO add your handling code here:
    }//GEN-LAST:event_paySearchButtonMouseClicked

    private void payAddButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_payAddButtonMouseClicked
        try {   
            ////////////////////////////////////////////////
            
            String ssn = paySSNBox.getText();
            String type = payTypeBox.getSelectedItem().toString();
            String routing = payRoutingNumBox.getText();
            String acct = payAcctNumBox.getText();
            
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!ssn.isEmpty() && !routing.isEmpty() && !acct.isEmpty())
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = "INSERT INTO PAYMENTTYPE VALUES (?,?,?,?)";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////
                statement.setString(1, type);
                statement.setString(2, routing);
                statement.setString(3, acct);
                statement.setString(4, ssn);
               

                /////////////////////////////////
                statement.executeUpdate(); 
                statement.close();
            
                /////////////////////////////////
                query = "SELECT * FROM PAYMENTTYPE";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }            // TODO add your handling code here:
    }//GEN-LAST:event_payAddButtonMouseClicked

    private void payUpdateButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_payUpdateButtonMouseClicked
        try {   
            String[] row = stringFromRow();

            ////////////////////////////////////////////////
            String ssn = paySSNBox.getText();
            String type = payTypeBox.getSelectedItem().toString();
            String routing = payRoutingNumBox.getText();
            String acct = payAcctNumBox.getText();
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!ssn.isEmpty() && !routing.isEmpty() && !acct.isEmpty())
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = "UPDATE PAYMENTTYPE SET ACCTTYPE = ? , ROUTINGNUM = ? ,  ACCTNUM = ? , TSSN = ?"                       
                        + "WHERE ACCTNUM = ? AND ROUTINGNUM = ?";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////
                statement.setString(1, type);
                statement.setString(2, routing);
                statement.setString(3, acct);
                statement.setString(4, ssn);
                statement.setString(5, row[1]);
                statement.setString(5, row[2]);
               

                /////////////////////////////////
                statement.executeUpdate(); 
                statement.close();
            
                /////////////////////////////////
                query = "SELECT * FROM PAYMENTTYPE";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        } // TODO add your handling code here:
    }//GEN-LAST:event_payUpdateButtonMouseClicked

    private void payDeleteButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_payDeleteButtonMouseClicked
        
        /////////////////////////////////////
        String query;
        String routing = payRoutingNumBox.getText();
            String acct = payAcctNumBox.getText();
        if(!routing.isEmpty() && !acct.isEmpty())
        {
            int choice = JOptionPane.showConfirmDialog(this, "Do you really want to delete this record?"
                ,"", JOptionPane.YES_NO_OPTION,
                JOptionPane.WARNING_MESSAGE
            );
            //user chose yes
            if(choice == 0)
            {
                try {
                    /////////////////////////////////////////////
                    query = "DELETE FROM PAYMENTTYPE WHERE ROUTINGNUM = ? AND ACCTNUM = ?  ";
                    //////////////////////////////////////////////
                    DBconnection db = new DBconnection();
                    Connection conn = db.getConnection();
                    PreparedStatement statement = null;
                    statement = conn.prepareStatement(query);
                    ///////////////////////////////
                    statement.setString(1, routing);
                    statement.setString(2, acct);
                    
                    //////////////////////////////
                    statement.executeUpdate();
                    statement.close();
                    /////////////////////////////////
                    query = "SELECT * FROM PAYMENTTYPE";
                    /////////////////////////////////
                    statement = conn.prepareStatement(query);
                    ResultSet rset = statement.executeQuery();

                    ListTableModel model = ListTableModel.createModelFromResultSet( rset );
                    table.setModel(model);

                } catch (SQLException ex) {
                    Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        else
        {
            JOptionPane.showMessageDialog(this, "Must enter Routing and Account Numbers");
        }// TODO add your handling code here:
    }//GEN-LAST:event_payDeleteButtonMouseClicked

    private void leaseDeleteButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_leaseDeleteButtonMouseClicked
           String ssn = leaseSSNBox.getText();
           String start = leaseStartDateBox.getText();
        /////////////////////////////////////
        String query;
        if(!ssn.isEmpty() && !start.isEmpty())
        {
            int choice = JOptionPane.showConfirmDialog(this, "Do you really want to delete this record?"
                ,"", JOptionPane.YES_NO_OPTION,
                JOptionPane.WARNING_MESSAGE
            );
            //user chose yes
            if(choice == 0)
            {
                try {
                    /////////////////////////////////////////////
                    query = "DELETE FROM LEASE WHERE STARTDATE = ? AND TSSN = ?  ";
                    //////////////////////////////////////////////
                    DBconnection db = new DBconnection();
                    Connection conn = db.getConnection();
                    PreparedStatement statement = null;
                    statement = conn.prepareStatement(query);
                    ///////////////////////////////
                    statement.setString(1, start);
                    statement.setString(2, ssn);
                    
                    //////////////////////////////
                    statement.executeUpdate();
                    statement.close();
                    /////////////////////////////////
                    query = "SELECT * FROM LEASE";
                    /////////////////////////////////
                    statement = conn.prepareStatement(query);
                    ResultSet rset = statement.executeQuery();

                    ListTableModel model = ListTableModel.createModelFromResultSet( rset );
                    table.setModel(model);

                } catch (SQLException ex) {
                    Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        else
        {
            JOptionPane.showMessageDialog(this, "Must enter Start Date and SSN");
        } // TODO add your handling code here:
    }//GEN-LAST:event_leaseDeleteButtonMouseClicked

    private void leaseUpdateButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_leaseUpdateButtonMouseClicked
       try {   
            ////////////////////////////////////////////////
                    String[] row = stringFromRow();
             String ssn = leaseSSNBox.getText();
            String start = leaseStartDateBox.getText();
            String type = leaseTypeDropBox.getSelectedItem().toString();
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!ssn.isEmpty() && !start.isEmpty())
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = "UPDATE LEASE SET KIND = ? , STARTDATE = ? ,  TSSN = ? ,"                       
                        + "WHERE SSN = ? AND STARTDATE = ";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////
                statement.setString(1, type);
                statement.setString(2, start);
                statement.setString(3, ssn);
                statement.setString(4, row[1]);
                statement.setString(5, row[2]);
               

                /////////////////////////////////
                statement.executeUpdate(); 
                statement.close();
            
                /////////////////////////////////
                query = "SELECT * FROM LEASE";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        } // TODO add your handling code here:
    }//GEN-LAST:event_leaseUpdateButtonMouseClicked

    private void leaseAddButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_leaseAddButtonMouseClicked
        try {   
            ////////////////////////////////////////////////
            
            String ssn = leaseSSNBox.getText();
            String start = leaseStartDateBox.getText();
            String type = leaseTypeDropBox.getSelectedItem().toString();
            
            /////////////////////////////////////////////////
            //////////////////////////////////////////////////////////////////////////////////
            if(!ssn.isEmpty() && !start.isEmpty())
            /////////////////////////////////////////////////////////////////////////////////
            {
                ///////////////////////////////////////////////////////////
                String query = "INSERT INTO LEASE VALUES (?,?,?)";
                /////////////////////////////////////////////////////////
                DBconnection db = new DBconnection();
                Connection conn = db.getConnection();
                PreparedStatement statement = null;
                statement = conn.prepareStatement(query);
                /////////////////////////////////
                statement.setString(1, type);
                statement.setString(2, start);
                statement.setString(3, ssn);
                
               

                /////////////////////////////////
                statement.executeUpdate(); 
                statement.close();
            
                /////////////////////////////////
                query = "SELECT * FROM LEASE";
                /////////////////////////////////
                table.setModel(getTableFromQuery(query));
            }
              else
        {
            String st="Please fill in all required fields.";
            JOptionPane.showMessageDialog(rootPane, st, null, JOptionPane.ERROR_MESSAGE); 
        }
           
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }         // TODO add your handling code here:
    }//GEN-LAST:event_leaseAddButtonMouseClicked

    private void leaseSearchButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_leaseSearchButtonMouseClicked
    try {
            String ssn = leaseSSNBox.getText();
            
            String query = "SELECT * FROM LEASE WHERE TSSN = '"+ ssn+"'";
        table.setModel(getTableFromQuery(query));
        } catch (SQLException ex) {
            Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
        }        // TODO add your handling code here:
    }//GEN-LAST:event_leaseSearchButtonMouseClicked

 
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton backButton;
    private javax.swing.JButton billAddButton;
    private javax.swing.JTextField billAmountBox;
    private javax.swing.JTextField billDateBox;
    private javax.swing.JButton billDeleteButton;
    private javax.swing.JPanel billPanel;
    private javax.swing.JTextField billPaymentDateBox;
    private javax.swing.JTextField billSSNBox;
    private javax.swing.JTextField billSSNSearchBox;
    private javax.swing.JButton billSearchButton;
    private javax.swing.JComboBox billTypeDropBox;
    private javax.swing.JButton billUpdateButton;
    private javax.swing.JButton emergAddButton;
    private javax.swing.JButton emergDeleteButton;
    private javax.swing.JButton emergUpdatebutton;
    private javax.swing.JTextField emergencyContactFirstNameBox;
    private javax.swing.JTextField emergencyContactLastNameBox;
    private javax.swing.JPanel emergencyContactPanel;
    private javax.swing.JTextField emergencyContactPhoneNumberBox;
    private javax.swing.JTextField emergencyContactSearchBox;
    private javax.swing.JButton emergencyContactSearchButton;
    private javax.swing.JTextField emergencyContactTenantSSNBox;
    private javax.swing.JButton employeeAddButton;
    private javax.swing.JTextField employeeAddressBox;
    private javax.swing.JTextField employeeCityBox;
    private javax.swing.JButton employeeDeleteButton;
    private javax.swing.JTextField employeeFirstNameBox;
    private javax.swing.JTextField employeeLastNameBox;
    private javax.swing.JPanel employeePanel;
    private javax.swing.JTextField employeePhoneNumberBox;
    private javax.swing.JTextField employeePositionBox;
    private javax.swing.JTextField employeeSSNBox;
    private javax.swing.JTextField employeeSearchBox;
    private javax.swing.JButton employeeSearchButton;
    private javax.swing.JComboBox employeeSearchDropBox;
    private javax.swing.JTextField employeeStateBox;
    private javax.swing.JButton employeeUpdateButton;
    private javax.swing.JTextField employeeZipBox;
    private javax.swing.JLayeredPane informationPane;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel111;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel42;
    private javax.swing.JLabel jLabel43;
    private javax.swing.JLabel jLabel44;
    private javax.swing.JLabel jLabel45;
    private javax.swing.JLabel jLabel46;
    private javax.swing.JLabel jLabel47;
    private javax.swing.JLabel jLabel48;
    private javax.swing.JLabel jLabel49;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel50;
    private javax.swing.JLabel jLabel51;
    private javax.swing.JLabel jLabel52;
    private javax.swing.JLabel jLabel53;
    private javax.swing.JLabel jLabel54;
    private javax.swing.JLabel jLabel55;
    private javax.swing.JLabel jLabel56;
    private javax.swing.JLabel jLabel57;
    private javax.swing.JLabel jLabel58;
    private javax.swing.JLabel jLabel59;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel60;
    private javax.swing.JLabel jLabel61;
    private javax.swing.JLabel jLabel62;
    private javax.swing.JLabel jLabel63;
    private javax.swing.JLabel jLabel64;
    private javax.swing.JLabel jLabel65;
    private javax.swing.JLabel jLabel66;
    private javax.swing.JLabel jLabel67;
    private javax.swing.JLabel jLabel68;
    private javax.swing.JLabel jLabel69;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel70;
    private javax.swing.JLabel jLabel71;
    private javax.swing.JLabel jLabel72;
    private javax.swing.JLabel jLabel74;
    private javax.swing.JLabel jLabel75;
    private javax.swing.JLabel jLabel77;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel81;
    private javax.swing.JLabel jLabel83;
    private javax.swing.JLabel jLabel85;
    private javax.swing.JLabel jLabel87;
    private javax.swing.JLabel jLabel88;
    private javax.swing.JLabel jLabel89;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabel94;
    private javax.swing.JLabel jLabel95;
    private javax.swing.JLabel jLabel97;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jTable1;
    private javax.swing.JButton leaseAddButton;
    private javax.swing.JButton leaseDeleteButton;
    private javax.swing.JPanel leasePanel;
    private javax.swing.JTextField leaseSSNBox;
    private javax.swing.JTextField leaseSSNSearchBox;
    private javax.swing.JButton leaseSearchButton;
    private datechooser.beans.DateChooserCombo leaseStartDateBox;
    private javax.swing.JComboBox leaseTypeDropBox;
    private javax.swing.JButton leaseUpdateButton;
    private javax.swing.JTextField payAcctNumBox;
    private javax.swing.JButton payAddButton;
    private javax.swing.JButton payDeleteButton;
    private javax.swing.JTextField payRoutingNumBox;
    private javax.swing.JTextField paySSNBox;
    private javax.swing.JTextField paySearchBox;
    private javax.swing.JButton paySearchButton;
    private javax.swing.JComboBox payTypeBox;
    private javax.swing.JButton payUpdateButton;
    private javax.swing.JPanel paymentInfoPanel;
    private javax.swing.JComboBox selectionBox;
    private javax.swing.JButton showAllButton;
    private javax.swing.JTable table;
    private javax.swing.JScrollPane tablePane;
    private javax.swing.JButton tenantAddButton;
    private javax.swing.JTextField tenantAptNumberBox;
    private javax.swing.JButton tenantDeleteButton;
    private javax.swing.JTextField tenantEmailBox;
    private javax.swing.JTextField tenantFirstNameBox;
    private javax.swing.JTextField tenantLastNameBox;
    private javax.swing.JPanel tenantPanel;
    private javax.swing.JTextField tenantPhoneNumberBox;
    private javax.swing.JTextField tenantSSNBox;
    private javax.swing.JTextField tenantSearchBox;
    private javax.swing.JButton tenantSearchButton;
    private javax.swing.JComboBox tenantSearchDropBox;
    private javax.swing.JButton tenantUpdateButton;
    private javax.swing.JButton utilitiesAdd;
    private javax.swing.JTextField utilitiesCostBox;
    private javax.swing.JButton utilitiesDelete;
    private javax.swing.JPanel utilitiesPanel;
    private javax.swing.JTextField utilitiesProviderBox;
    private javax.swing.JComboBox utilitiesTypeBox;
    private javax.swing.JButton utilitiesUpdate;
    private javax.swing.JButton vehicleAddButton;
    private javax.swing.JButton vehicleDeleteButton;
    private javax.swing.JTextField vehicleLicensePlateBox;
    private javax.swing.JTextField vehicleMakeBox;
    private javax.swing.JTextField vehicleModelBox;
    private javax.swing.JTextField vehicleOwnerSSNBox;
    private javax.swing.JPanel vehiclePanel;
    private javax.swing.JButton vehicleSearchButton;
    private javax.swing.JTextField vehicleSearchLicensePlateBox;
    private javax.swing.JTextField vehicleSearchStateBox;
    private javax.swing.JTextField vehicleStateBox;
    private javax.swing.JButton vehicleUpdateButton;
    private javax.swing.JTextField vehicleYearBox;
    private javax.swing.JButton writeUpAddButton;
    private javax.swing.JTextField writeUpDateBox;
    private javax.swing.JButton writeUpDeleteButton;
    private javax.swing.JTextArea writeUpDescriptionBox;
    private javax.swing.JPanel writeUpPanel;
    private javax.swing.JTextField writeUpSSNBox;
    private javax.swing.JTextField writeUpSSNSearchBox;
    private javax.swing.JButton writeUpSearchButton;
    private javax.swing.JComboBox writeUpTypeDropBox;
    private javax.swing.JButton writeUpUpdateButton;
    // End of variables declaration//GEN-END:variables
}
